using UnityEngine;
using System.Collections;

public class Move1 : MonoBehaviour {
	
	float speed = 15.0f;

	

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	






		if (GameObject.FindGameObjectWithTag ("bullet") == null) {

						if (gameObject.name == "Tank1" && Kamera.turn == false) {
								if (Input.GetKey ("left"))
										rigidbody.velocity = new Vector3 (speed, 0.0f, 0.0f);
								if (Input.GetKey ("right"))
										rigidbody.velocity = new Vector3 (-speed, 0.0f, 0.0f);
			
								if (Input.GetKeyUp ("left"))
										rigidbody.velocity = new Vector3 (0.0f, 0.0f, 0.0f);
								if (Input.GetKeyUp ("right"))
										rigidbody.velocity = new Vector3 (0.0f, 0.0f, 0.0f);
						}
						if (gameObject.name == "Tank2" && Kamera.turn == true) {
								if (Input.GetKey ("left"))
										rigidbody.velocity = new Vector3 (speed, 0.0f, 0.0f);
								if (Input.GetKey ("right"))
										rigidbody.velocity = new Vector3 (-speed, 0.0f, 0.0f);
			
								if (Input.GetKeyUp ("left"))
										rigidbody.velocity = new Vector3 (0.0f, 0.0f, 0.0f);
								if (Input.GetKeyUp ("right"))
										rigidbody.velocity = new Vector3 (0.0f, 0.0f, 0.0f);
						}
		
				}
		
	}
void OnCollisionEnter (Collision c)
	{
				if (c.gameObject.tag == "bullet") {
						Destroy (gameObject);


						Destroy (c.gameObject);
				}
		}
}

